﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using SQLHelper;
using System.Web.Security;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (Page.User.Identity.IsAuthenticated)
            Response.Redirect("index.aspx");


    }
  
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("register.aspx");
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Membership.ValidateUser(TextBox1.Text, TextBox2.Text))
        {
            FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, true);
        }
        else
        {
            Label1.Text = "登录失败,用户名或密码错误!";
            return;
        }
        Response.Redirect("index.aspx");

    }
}